import { createRouter, createWebHistory } from 'vue-router';
import routes from './routes';
import { loading } from '@/components/lib/loading';
const load = loading();

// 创建路由
const router = createRouter({
  history: createWebHistory(), //可传参数，配置base路径，例如'/app'
  routes,
});
// 路由守卫
router.beforeEach((to, from, next) => {
  // const token = auth();
  // 启动进度条
  load.show();
  let title: any = to.meta.title;
  if (undefined === title) {
    title = '在线支付';
  }
  document.title = title;
  // 无意义
  from.fullPath;
  next();
  // 关闭进度条
  load.duration();
});

export default router;
